//
//  XXHUD.swift
//  手账
//
//  Created by zhuxiaoxiang on 2018/12/15.
//  Copyright © 2018年 zhuxiaoxiang. All rights reserved.
//

import UIKit
import MBProgressHUD

struct XXHUD {
    
    static let sharedInstance = XXHUD()
    
    func showLoading(_ view: UIView) {
        MBProgressHUD.showAdded(to: view, animated: true)
    }
    
    func hide(_ view: UIView) {
        MBProgressHUD.hide(for: view, animated: true)
    }
    
    func showMessage(view: UIView, _ text: String) {
        let hud = MBProgressHUD.showAdded(to: view, animated: true)
        hud.label.text = text
        hud.mode = MBProgressHUDMode.text
        hud.removeFromSuperViewOnHide = true
        hud.hide(animated: true, afterDelay: 1.5)
    }
}
